import request from '../../utils/request'


/**
 * 获取联系人列表
 * @param cstId
 * @param page
 * @returns {Promise.<void>}
 */
export async function getLinkmanList({cstId,status, page}) {
    return request(apiPath.imagent + "/api/" + cstId + "/linkmans/page", {
        method: 'get',
        data: {status, page: page.page, size: page.size}
    });
}


/**
 * 增加联系人
 * @param params
 * @returns {Promise.<void>}
 */
export async function addLinkman(params) {
    return request(apiPath.imagent + "/api/linkman", {
        method: 'post',
        data: params
    });
}


/**
 * 更新联系人
 * @param params
 * @returns {Promise.<void>}
 */
export async function updateLinkman(params) {
    return request(apiPath.imagent + "/api/linkman", {
        method: 'put',
        data: params
    });
}

/**
 * 根据id获取联系人
 * @param id
 * @returns {Promise.<void>}
 */
export async function getLinkmanById({id}) {
    return request(apiPath.imagent + "/api/linkman/"+ id, {
        method: 'get'
    });
}



/**
 * 删除联系人
 * @param id
 * @returns {Promise.<void>}
 */
export async function deleteLinkmanById({id}) {
    return request(apiPath.imagent + "/api/linkman/"+ id, {
        method: 'delete'
    });
}